package rateexchange.client.mvp;

import com.google.gwt.activity.shared.Activity;
import com.google.gwt.activity.shared.ActivityMapper;
import com.google.gwt.place.shared.Place;

import rateexchange.client.ClientFactory;
import rateexchange.client.place.RatePlace;
import rateexchange.client.place.RatesTablePlace;


// Defines the mapping between places and corresponding activities
public class RatesActivityMapper implements ActivityMapper{
	private ClientFactory clientfactory;
	
	public RatesActivityMapper(ClientFactory clientFactory){
		super();
		this.clientfactory = clientFactory;
	}

	@Override
	public Activity getActivity(Place place) {
		if (place instanceof RatesTablePlace)
			return new RatesTableActivity((RatesTablePlace) place, clientfactory);
	else if (place instanceof RatePlace)
			return new RateActivity((RatePlace) place, clientfactory);
		return null;
	}
	
	
}
